package ca.uwo.android.directoryservice;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

public abstract class DirectorySearchData implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 2410376743477048475L;
	
	private String firstname;
	private String lastname;
	private String email;

	public abstract boolean isStudent();
	public abstract boolean isFaculty();

	public DirectorySearchData(JSONObject data) throws JSONException {
		firstname = null;
		lastname = null;
		email = null;
		
		if(data.has("firstName"))
			firstname = data.getString("firstName");
		
		if(data.has("lastName"))
			lastname = data.getString("lastName");
		
		if(data.has("email"))
			email = data.getString("email");
	}
	
	public String getFullName() {
		return firstname + " " + lastname;
	}
	
	public String getLastName() {
		return lastname;
	}
	
	public String getFirstName() {
		return firstname;
	}
	
	public String getEmail() {
		return email;
	}
	
	public String toString() {
		return firstname + " " + lastname;
	}
}